﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;


    public class imsitemHier : IHierarchyData
    {

        public imsitemHier(imsitem objImsitemIn):base()
        {
            objImsitem = objImsitemIn;

        }


        imsitem _objImsitem = new imsitem();

        public imsitem objImsitem
        {
            get { return _objImsitem; }
            set { _objImsitem = value; }
        }



        public string id
        {
            get
            {
                return objImsitem.id;
            }
        }
        public string parentID
        {
            get
            {
                return objImsitem.parentID;
            }
        }

        public string title
        {
            get
            {
                return objImsitem.title;
            }
        }
        public string href
        {
            get
            {
                return objImsitem.href;
            }
        }

        public imsitem parent
        {
            get
            {
                return objImsitem.parent;
            }
        }
        public List<imsitem> childs
        {
            get
            {
                return objImsitem.childs;
            }
        }


       

        


        // Summary:
        //     Indicates whether the hierarchical data node that the System.Web.UI.IHierarchyData
        //     object represents has any child nodes.
        //
        // Returns:
        //     true if the current node has child nodes; otherwise, false.
        public bool HasChildren {

            get
            {
                if (childs == null)
                    return false;

                return (childs.Count > 0);
            }
        
        
        }
        //
        // Summary:
        //     Gets the hierarchical data node that the System.Web.UI.IHierarchyData object
        //     represents.
        //
        // Returns:
        //     An System.Object hierarchical data node object.
        public object Item {


            get
            {
                return objImsitem;
            }
            
            
            
            }
        //
        // Summary:
        //     Gets the hierarchical path of the node.
        //
        // Returns:
        //     A System.String that identifies the hierarchical path relative to the current
        //     node.
        public string Path {
            get
            {
               return "";
            }
            
            
             }
        //
        // Summary:
        //     Gets the name of the type of System.Object contained in the System.Web.UI.IHierarchyData.Item
        //     property.
        //
        // Returns:
        //     The name of the type of object that the System.Web.UI.IHierarchyData object
        //     represents.
        public string Type {


            get
            {
                return "imsitem";
            }
            
            
            }

        // Summary:
        //     Gets an enumeration object that represents all the child nodes of the current
        //     hierarchical node.
        //
        // Returns:
        //     An System.Web.UI.IHierarchicalEnumerable collection of child nodes of the
        //     current hierarchical node.
        public IHierarchicalEnumerable GetChildren()
        {
            if (childs != null)
                return new imsitemHierList(childs);
            else
                return new imsitemHierList(new List<imsitem> ());

        }


        //
        // Summary:
        //     Gets an System.Web.UI.IHierarchyData object that represents the parent node
        //     of the current hierarchical node.
        //
        // Returns:
        //     An System.Web.UI.IHierarchyData object that represents the parent node of
        //     the current hierarchical node.
        public IHierarchyData GetParent()
        {
            if (parent == null)
                return null;

            return new imsitemHier(parent);
            
            
        }
    }

